#include "gate.h"
#include "sysserversocket.h"

Framework *g_fwGate = nullptr;
Gate::Gate()
{
    start();
}

void Gate::close()
{
    return;
    uv_async_send(_clientSocketProc->getAsync());
    uv_async_send(_srvSocketProc->getAsync());
}

void Gate::run()
{
    return;
    FRAMEWORK = new Framework();
    FRAMEWORK->readComDefinition("cns/gate");
    _srvSocketProc = FRAMEWORK->newComponent("gateServerSocket", "/server/.//serverSocket").staticCast<ServerSocketProc>();
    _clientSocketProc = FRAMEWORK->newComponent("gatelientSocket", "/server/.//serverClientSocket").staticCast<ClientSocketProc>();
    uv_loop_t *loop = uv_loop_new();
    _srvSocketProc->exec("run", Q_ARG(uv_loop_t*, loop));
    uv_run(loop, UV_RUN_DEFAULT);

    SYS(SysServerSocket)->server_destroy(_srvSocketProc.data());
    uv_loop_close(loop);
    free(loop);

}
